<?php


namespace App\Models;


use App\Engine\BaseModel;
use App\Exceptions\ApiException;

class BindGood extends BaseModel
{
    protected $table = 'bind_goods';
    public $timestamps = false;
    protected $fillable = [
        'name',
        'image',
        'num'
    ];

    public  function checkStock()
    {
        $count=$this->sum("num");
        if ($count==0){
            throw new ApiException("活动已结束");
        }
    }
}
